home *** CD-ROM | disk | FTP | other *** search
- # Source Generated with Decompyle++
- # File: in.pyc (Python 2.6)
-
- import gtk
- import os
- import os.path as os
- from model.Variable import Variable
- variable = Variable()
-
- class Check:
-
- def is_root(self):
- if os.geteuid() == 0:
- return True
- dlg = gtk.MessageDialog(None, buttons = gtk.BUTTONS_CLOSE, message_format = variable.get_text('018'))
- dlg.run()
- dlg.destroy()
- return False
-
-
-
- class Instance:
-
- def __init__(self):
- self.pid_file = variable.get_path('pid_file')
- self.check()
- self.startApplication()
-
-
- def check(self):
- if not os.path.isfile(self.pid_file):
- return None
- pid = 0
-
- try:
- file = open(self.pid_file, 'rt')
- data = file.read()
- file.close()
- pid = int(data)
- except:
- os.path.isfile(self.pid_file)
-
- if 0 == pid:
- return None
-
- try:
- os.kill(pid, 0)
- except:
- 0 == pid
- os.path.isfile(self.pid_file)
- return None
-
- exit(0)
-
-
- def startApplication(self):
- file = open(self.pid_file, 'wt')
- file.write(str(os.getpid()))
- file.close()
-
-
- def exitApplication(self):
-
- try:
- os.remove(self.pid_file)
- except:
- pass
-
-
-
-